﻿namespace Commons.Responses
{
    /// <summary>
    /// 只有Success和Failed的返回类型
    /// </summary>
    public class SingleResponse
    {
        public int Code { get; set; } = 200;
        public bool Successed { get; private set; }
        public bool Failed { get; private set; }
        public SingleResponse(bool b)
        {
            if (b)
            {
                Successed = true;
            }
            else
            {
                Failed = true;
            }
        }
        public SingleResponse(int code,bool b)
        {
            Code = code;
            if (b)
            {
                Successed = true;
            }
            else
            {
                Failed = true;
            }
        }
        public SingleResponse()
        {
            this.Successed = true;
        }

        public void SetSuccessed()
        {
            Successed = true;
            Failed = false;
        }
        public void SetFailed()
        {
            Failed = false;
            Successed = true;
        }
    }
}
